//
//  AreaBookTableViewCell.m
//  HelpThePoor
//
//  Created by van7ish on 2016/12/3.
//  Copyright © 2016年 van7ish. All rights reserved.
//

#import "AreaBookTableViewCell.h"

#define cellHeight (SCREEN_W / 3.35)

@implementation AreaBookTableViewCell

- (UILabel *)label{
    if (!_label) {
        _label = [[UILabel alloc] initWithFrame:CGRectMake(0, self.coverImageView.frame.size.height - HeightScale(25), self.coverImageView.frame.size.width, HeightScale(25))];
        _label.font = FONTSIZE(15);
        _label.textColor = COLOR_WHITE;
        _label.textAlignment = NSTextAlignmentCenter;
    }
    return _label;
}

- (UIImageView *)coverImageView{
    if (!_coverImageView) {
        _coverImageView = [[UIImageView alloc] initWithFrame:CGRectMake(WidthScale(20), HeightScale(15), (cellHeight - HeightScale(30)) * 1.27, cellHeight - HeightScale(30))];
        _coverImageView.image = ImageNamed(@"6");
    }
    return _coverImageView;
}

- (UILabel *)titleLabel{
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.coverImageView.frame) + WidthScale(10), HeightScale(15), WidthScale(250), HeightScale(90))];
//        _titleLabel.text = @"科学大观 / 探索自然 / 科技之光 / 环保防灾";
        _titleLabel.font = FONTSIZE(15);
        _titleLabel.textColor = COLOR_FONTBLACK;
        _titleLabel.numberOfLines = 0;
    }
    return _titleLabel;
}

- (UIView *)underLine{
    if (!_underLine) {
        _underLine = [[UIView alloc] initWithFrame:CGRectMake(WidthScale(10), cellHeight - 0.5, SCREEN_W - WidthScale(10) * 2, 0.5)];
        _underLine.backgroundColor = COLOR_GRAYLINE;
    }
    return _underLine;
}

- (UIImageView *)arrowImageView{
    if (!_arrowImageView) {
        _arrowImageView = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_W - WidthScale(50), cellHeight - HeightScale(44), WidthScale(44), HeightScale(46))];
        _arrowImageView.image = ImageNamed(@"xia");
    }
    return _arrowImageView;
}

- (void)layoutSubviews{
    [super layoutSubviews];
    
    self.contentView.backgroundColor = COLOR_LIGHTBGCOLOR;
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    [self.contentView addSubview:self.coverImageView];
    [self.contentView addSubview:self.titleLabel];
    [self.contentView addSubview:self.underLine];
    [self.contentView addSubview:self.arrowImageView];
    [self.coverImageView addSubview:self.label];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
